#include "expresultframe.h"
#include "ui_expresultframe.h"

ExpResultFrame::ExpResultFrame(QWidget *parent,Experiment* pExperiment) :
    QFrame(parent),
    ui(new Ui::ExpResultFrame)
{
    ui->setupUi(this);
    this->pExperiment=pExperiment;

    pExpResultCalFrame=new ExpResultCalFrame(this,pExperiment);
    pExpResultDataFrame=new ExpResultDataFrame(this,pExperiment);
    pExpResultSpectralFrame=new ExpResultSpectralFrame(this,pExperiment);
    ui->tabWidget->addTab(pExpResultCalFrame,tr("校正曲线"));
    ui->tabWidget->addTab(pExpResultDataFrame,tr("数据结果"));
    ui->tabWidget->addTab(pExpResultSpectralFrame,tr("谱图"));

}

ExpResultFrame::~ExpResultFrame()
{
    delete ui;
}

void ExpResultFrame::LoadData()
{
    on_tabWidget_currentChanged(ui->tabWidget->currentIndex());
    pExperiment->Analyzed();
}

void ExpResultFrame::on_tabWidget_currentChanged(int index)
{
    switch(index)
    {
    case 0: 
        pExpResultCalFrame->LoadData();
        break;
    case 1:
        pExpResultDataFrame->LoadData();
        break;
    case 2:
        pExpResultSpectralFrame->LoadData();
        break;
    }
}
